<template>
  <div>
    <div class="pladtform-header"><h1>平台动态</h1></div>
    <div class="platform-main">
      <el-table
        :data="tableData"
        style="width: 80%; margin-left: 100px"
        @row-click="getDetail"
      >
        <el-table-column prop="date" label="序号" width="100" type="index" />
        <el-table-column prop="title" label="动态标题" />
        <el-table-column prop="releaseTime" label="发布时间" width="180">
          <template slot-scope="scope">
            <!-- 图标 -->
            <i class="el-icon-time" style="margin-right: 10px"></i>
            <!-- 时间 -->
            <span>{{ scope.row.releaseTime }}</span>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="platform-footer" style="margin-left: 75%">
      <el-pagination
        :current-page.sync="currentPage"
        :page-size="pageSize"
        :disabled="disabled"
        background
        layout=" prev, pager, next"
        :total="total"
        @current-change="getplatFormLists"
      />
    </div>
  </div>
</template>


<script>
import { getplatFormList, getplatFormPage } from "@/api/plantform/plantform";

export default {
  name: "Plantform",
  data() {
    return {
      disabled: false,
      tableData: [],
      currentPage: 1,
      pageSize: 15,
      total: 0,
    };
  },
  methods: {
    async getplatFormLists() {
      const res = await getplatFormPage({
        pageIndex: this.currentPage,
        pageSize: this.pageSize,
        listType: 3,
      });
      this.tableData = res.data;
      this.total = res.total;
    },
    getDetail(val) {
      // 跳转详情页
      this.$router.push({
        path: "/plantformdetail",
        query: { listId: val.listId },
      });
      // console.log(val.listId);
    },
  },
  mounted() {
    this.getplatFormLists();
  },
};
</script>

<style  scoped>
h1 {
  text-align: center;
}
</style>
